package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.Brand;
import com.cskaoyan.bean.wx.WxBaseRespVo;
import com.cskaoyan.bean.wxbean.BrandsQueryVO;
import com.cskaoyan.service.wx.WxBrandListService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Enzo Cotter on 2020/10/8.
 */
@RestController
@RequestMapping("wx/brand/")
public class WxBrandController {

    @Autowired
    WxBrandListService wxBrandListService;

    @RequestMapping("list")
    public WxBaseRespVo brandList(Integer page, Integer size){
        BrandsQueryVO brandsQueryVO = wxBrandListService.queryBrands(page,size);
        return WxBaseRespVo.ok(brandsQueryVO);
    }

    @RequestMapping("detail")
    public WxBaseRespVo brandDetail(Integer id){
        HashMap<Object, Object> map = new HashMap<>();
        Brand brand = wxBrandListService.getBrandById(id);
        map.put("brand",brand);
        return WxBaseRespVo.ok(map);
    }

}
